package br.com.cadele.beans;

import java.io.Serializable;
import java.util.ArrayList;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

import br.com.cadele.model.Professor;
import br.com.cadele.service.ProfessorService;
@ManagedBean(name="visualizarProfessorBean")
@ViewScoped
@URLBeanName(value="visualizarProfessorBean")
@URLMapping(id="visualizarProfessorBean", pattern="/professor/visualizar", viewId="/pages/professor/visualizar.xhtml")
public class VisualizarProfessorBean implements Serializable {

	/**
	 * 
	 */
	
	Professor professor;
    private ProfessorService professorService;
    private ArrayList<Professor> professorList;

    @PostConstruct
    public void init(){
        professorService = new ProfessorService();
        professorList = professorService.getAll();
    }
    
    public void salvar() {
			professorService.executeInsert(professor);
    }
    
    public ArrayList<Professor> getProfessorList(){
      return professorList;
    }
    
    public void setProfessorList(ArrayList<Professor> professorList){
      this.professorList = professorList;
    }
}
